<?php
	echo $this->MForm->create('DefinedLanguage', array('id' => 'contentform', 
		'action' => 'edit/'.$defined_key, 
		//'url' => '/defined_languages/edit/'.$defined_key
	));
	echo '<table width="100%" cellpadding="0" cellspacing="0" class="table">';
	$tableHeaders = $this->Html->tableHeaders(array(
		'标志符',
		'英文','中文',
		__('Actions'),
	));
	echo $tableHeaders;


	$rows = array();
	foreach ($lang_definitions AS $key => $lange) {
		$actions  = $this->Html->link(lang('edit_key'), array('action' => 'editkey',$key),array('class'=>'btn btn-primary'));
		$actions  .= $this->Html->link(lang('delete'), array('action' => 'delete',$key),array('class'=>'btn btn-warning'));
		$row = 	array();	
		$row[] = $key;
		foreach($languages as $l){
			$item = $lange[$l['Language']['id']];
			$row[] = 
				$this->MForm->hidden('DefinedLanguage.'.$key.'.'.($item['DefinedLanguage']['id']?$item['DefinedLanguage']['id']:0).'.language_id',array(
						'value'=>$l['Language']['id'],
					)).
				$this->MForm->input('DefinedLanguage.'.$key.'.'.($item['DefinedLanguage']['id']?$item['DefinedLanguage']['id']:0).'.value',array(
   				   		'label' => false,'div'=>false,'type'=>'text',
   						'value' => $item['DefinedLanguage']['value']
	               ));
		}
		$row[] =$actions;
		$rows[] = $row;
	}
	echo $this->Html->tableCells($rows);
	
	echo $tableHeaders;
	echo '</table>';
	
	echo $this->MForm->submit(__('Submit'), array('name' => 'submit'));
	echo $this->MForm->end();
?>
<div class="clear"></div>